package com.datastructure.test.rectcover;

import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;

public class RectCover {
    public int result = 0;
    public static void main(String[] args) {
        RectCover rectCover = new RectCover();
        int i = rectCover.rectCover(4);
        System.out.println(i);
    }

    public int rectCover(int target) {
        int[] data = {1,2};
        Deque<Integer> deque = new ArrayDeque<>();
        insertList(data,deque,target);
        return result;
    }

    private void insertList(int[] data, Deque<Integer> deque, int target) {
        if(target<0){
            return;
        }
        if(target==0&&deque.size()>0){
            result++;
            return;
        }
        for (int i = 0; i < data.length; i++) {
            deque.add(data[i]);
            insertList(data,deque,target-data[i]);
            deque.removeLast();
        }
    }
}
